
var gCurrentHeight = 0;
var gFinalHeight = 50;
var gSlideIncrement = 1;
var gSlideTime = 10;
var gOpenTime = 3000;



function onNotifierLoad()
{
	if ( window.arguments[0] )
	{
        var elem=document.getElementById('trucoder-notifier-text');
        elem.setAttribute("value", window.arguments[0]);
    }

    window.sizeToContent();
    if ( screen.availWidth > 0 && navigator.platform == "Win32" )
	{
		gFinalHeight = window.outerHeight;
		window.outerHeight = 0;
		window.moveTo( (screen.availLeft + screen.availWidth - window.outerWidth) - 10, screen.availTop + screen.availHeight - window.outerHeight);
		setTimeout(animateNotifier, gSlideTime);
	}
	else
	{
		window.moveTo(
			window.opener.screenX + window.opener.outerWidth - window.outerWidth,
			window.opener.screenY + window.opener.outerHeight - window.outerHeight
		);
		setTimeout(function(){ window.close(); }, gOpenTime * 2);
	}
}

function animateNotifier()
{
	if ( gCurrentHeight < gFinalHeight ) {
		gCurrentHeight += gSlideIncrement;
		window.screenY -= gSlideIncrement;
		window.outerHeight += gSlideIncrement;
		setTimeout(animateNotifier, gSlideTime);
	} else {
		setTimeout(closeNotifier, gOpenTime);
	}
}

function closeNotifier()
{
	if ( gCurrentHeight ) {
		gCurrentHeight -= gSlideIncrement;
		window.screenY += gSlideIncrement;
		window.outerHeight -= gSlideIncrement;
		setTimeout(closeNotifier, gSlideTime);
	} else {
		window.close();
	}
}

function onNotifierClick()
{
	window.close();
}


